package jmu.cyxwcy.librarymanagement.controller;


import jmu.cyxwcy.librarymanagement.pojo.BorrowType;
import jmu.cyxwcy.librarymanagement.pojo.Classes;
import jmu.cyxwcy.librarymanagement.pojo.Result;
import jmu.cyxwcy.librarymanagement.service.IBorrowTypeService;
import jmu.cyxwcy.librarymanagement.service.IBorrowingService;
import jmu.cyxwcy.librarymanagement.service.IClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 
 * @since 2024-06-27
 */
@RestController
@RequestMapping("/borrow-type")
//借阅类型
public class BorrowTypeController {
    @Autowired
    private IBorrowTypeService iBorrowTypeService;

    @PostMapping("/add")
    public Result add(@RequestBody BorrowType borrowType){
        iBorrowTypeService.getBaseMapper().insert(borrowType);
        return Result.success();
    }

    @PutMapping("/update")
    public Result update(@RequestBody BorrowType borrowType){
        iBorrowTypeService.updateById(borrowType);
        return Result.success();
    }

    @DeleteMapping("/delete")
    public Result delete(Integer borrowTypeId){
        iBorrowTypeService.removeById(borrowTypeId);
        return Result.success();
    }
}
